<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/register.css">
    <link rel="stylesheet" href="font/font_fdwb8ucgghk/iconfont.css">
    <link rel="stylesheet" href="css/login.css">
    <script src="js/jquery.js"></script>

    <title>登录</title>
</head>

<body>
    <div class="wraptop">
        <div>
            <ul>
                <li><a class="lw">中关村在线</a></li>
                <li><a>ZOL企业购</a></li>
                <li><a>解决方案馆</a></li>
                <li><a>中在指数</a></li>
                <li><a class="lm">供应商入驻</a></li>
            </ul>
            <ul>
                <li><a href="">登录</a></li>
                <li><a href="register.html" class="lm">注册</a></li>
            </ul>

        </div>
    </div>
    <div class="logo">
        <img src="img/logo.png" alt="">
        <div>欢迎登录</div>
    </div>
    <div class="section">
        <div class="wrapper">
            <div class="box">
                <h3>会员登录</h3>
                <span>没有账号? &nbsp;<a href="register.html">立即注册</a></span>
                <div><i class="iconfont icon-shouji"></i><input type="text" id="ind1"></div>
                <div><i class="iconfont icon-suo"></i><input type="password" id="ind2"></div>
                <input type="button" value="登 录" id="btn2">
                <p>忘记密码</p>
            </div>
        </div>
        <div class="footer">
            <div>
                <div><img src="img/下载.png" alt=""><span>热线电话</span><span>400-688-1999</span></div>
                <p>©2021 北京知行锐景科技有限公司 / 北京中在云商科技有限公司 版权备案单位/子公司</p>
                <p>京ICP证150096号 &nbsp;&nbsp;&nbsp;京ICP备14061128号&nbsp;&nbsp;&nbsp; 京公网安备11010802020026号&nbsp;&nbsp;&nbsp; 网络文化经营许可证京网文[2016]1631-199 &nbsp;&nbsp;&nbsp;增值电信业务经营许可证：京B2-20200543</p>

            </div>
        </div>
    </div>
    <script>
        $(function() {
            $("#btn2").click(function() {
                if ($("#ind1").val() && $("#ind2").val() != "") {
                    $.get("http://jx.xuzhixiang.top/ap/api/login.php", {
                        username: $("#ind1").val(),
                        password: $("#ind2").val(),
                    }, res => {
                        let str = "";
                        let arr = "";
                        console.log(res)
                        str = res.data.username;
                        id = res.data.id;
                        console.log(str)
                        if (res.code == 1) {
                            alert("登录成功")
                            localStorage.setItem("ursername", JSON.stringify(str))
                            localStorage.setItem("id", JSON.stringify(id))
                            location.href = "index.html"
                        } else {
                            alert("用户名或密码不正确")
                        }
                    })
                } else {
                    alert("用户名或密码不能为空")
                }
            })
        })
    </script>
</body>

</html>